cfg = []
if get_option('LV_CONF_INCLUDE_SIMPLE')
  cfg += '-DLV_CONF_INCLUDE_SIMPLE'
endif
if get_option('LV_CONF_PATH') != ''
  cfg += '-DLV_CONF_PATH=' + get_option('LV_CONF_PATH')
endif
if get_option('LV_CONF_SKIP')
  cfg += '-DLV_CONF_SKIP=1'
endif
if get_option('LV_LVGL_H_INCLUDE_SIMPLE')
  cfg += '-DLV_LVGL_H_INCLUDE_SIMPLE'
endif

lvgl_links = []
if not get_option('LV_CONF_BUILD_DISABLE_THORVG_INTERNAL')
  subdir('libs/thorvg')
  lvgl_links += thorvg
endif

# On GNU systems, use
#   find -type f -name '*.c' | sed -e "s|\.\/|\'|" -e "s|\.c$|.c\'\,|"
# to list source files.
lvgl_src = [
  'core/lv_group.c',
  'core/lv_obj.c',
  'core/lv_obj_class.c',
  'core/lv_obj_draw.c',
  'core/lv_obj_event.c',
  'core/lv_obj_id_builtin.c',
  'core/lv_obj_pos.c',
  'core/lv_obj_property.c',
  'core/lv_obj_scroll.c',
  'core/lv_obj_style.c',
  'core/lv_obj_style_gen.c',
  'core/lv_obj_tree.c',
  'core/lv_refr.c',
  'display/lv_display.c',
  'draw/dma2d/lv_draw_dma2d.c',
  'draw/dma2d/lv_draw_dma2d_fill.c',
  'draw/dma2d/lv_draw_dma2d_img.c',
  'draw/lv_draw.c',
  'draw/lv_draw_3d.c',
  'draw/lv_draw_arc.c',
  'draw/lv_draw_buf.c',
  'draw/lv_draw_image.c',
  'draw/lv_draw_label.c',
  'draw/lv_draw_line.c',
  'draw/lv_draw_mask.c',
  'draw/lv_draw_rect.c',
  'draw/lv_draw_triangle.c',
  'draw/lv_draw_vector.c',
  'draw/lv_image_decoder.c',
  'draw/nema_gfx/lv_draw_nema_gfx.c',
  'draw/nema_gfx/lv_draw_nema_gfx_arc.c',
  'draw/nema_gfx/lv_draw_nema_gfx_border.c',
  'draw/nema_gfx/lv_draw_nema_gfx_fill.c',
  'draw/nema_gfx/lv_draw_nema_gfx_img.c',
  'draw/nema_gfx/lv_draw_nema_gfx_label.c',
  'draw/nema_gfx/lv_draw_nema_gfx_layer.c',
  'draw/nema_gfx/lv_draw_nema_gfx_line.c',
  'draw/nema_gfx/lv_draw_nema_gfx_stm32_hal.c',
  'draw/nema_gfx/lv_draw_nema_gfx_triangle.c',
  'draw/nema_gfx/lv_draw_nema_gfx_utils.c',
  'draw/nema_gfx/lv_nema_gfx_path.c',
  'draw/nxp/g2d/lv_draw_buf_g2d.c',
  'draw/nxp/g2d/lv_draw_g2d.c',
  'draw/nxp/g2d/lv_draw_g2d_fill.c',
  'draw/nxp/g2d/lv_draw_g2d_img.c',
  'draw/nxp/g2d/lv_g2d_buf_map.c',
  'draw/nxp/g2d/lv_g2d_utils.c',
  'draw/nxp/pxp/lv_draw_buf_pxp.c',
  'draw/nxp/pxp/lv_draw_pxp.c',
  'draw/nxp/pxp/lv_draw_pxp_fill.c',
  'draw/nxp/pxp/lv_draw_pxp_img.c',
  'draw/nxp/pxp/lv_draw_pxp_layer.c',
  'draw/nxp/pxp/lv_pxp_cfg.c',
  'draw/nxp/pxp/lv_pxp_osa.c',
  'draw/nxp/pxp/lv_pxp_utils.c',
  'draw/nxp/vglite/lv_draw_buf_vglite.c',
  'draw/nxp/vglite/lv_draw_vglite.c',
  'draw/nxp/vglite/lv_draw_vglite_arc.c',
  'draw/nxp/vglite/lv_draw_vglite_border.c',
  'draw/nxp/vglite/lv_draw_vglite_fill.c',
  'draw/nxp/vglite/lv_draw_vglite_img.c',
  'draw/nxp/vglite/lv_draw_vglite_label.c',
  'draw/nxp/vglite/lv_draw_vglite_layer.c',
  'draw/nxp/vglite/lv_draw_vglite_line.c',
  'draw/nxp/vglite/lv_draw_vglite_triangle.c',
  'draw/nxp/vglite/lv_vglite_buf.c',
  'draw/nxp/vglite/lv_vglite_matrix.c',
  'draw/nxp/vglite/lv_vglite_path.c',
  'draw/nxp/vglite/lv_vglite_utils.c',
  'draw/opengles/lv_draw_opengles.c',
  'draw/renesas/dave2d/lv_draw_dave2d.c',
  'draw/renesas/dave2d/lv_draw_dave2d_arc.c',
  'draw/renesas/dave2d/lv_draw_dave2d_border.c',
  'draw/renesas/dave2d/lv_draw_dave2d_fill.c',
  'draw/renesas/dave2d/lv_draw_dave2d_image.c',
  'draw/renesas/dave2d/lv_draw_dave2d_label.c',
  'draw/renesas/dave2d/lv_draw_dave2d_line.c',
  'draw/renesas/dave2d/lv_draw_dave2d_mask_rectangle.c',
  'draw/renesas/dave2d/lv_draw_dave2d_triangle.c',
  'draw/renesas/dave2d/lv_draw_dave2d_utils.c',
  'draw/sdl/lv_draw_sdl.c',
  'draw/sw/blend/lv_draw_sw_blend.c',
  'draw/sw/blend/lv_draw_sw_blend_to_al88.c',
  'draw/sw/blend/lv_draw_sw_blend_to_argb8888.c',
  'draw/sw/blend/lv_draw_sw_blend_to_argb8888_premultiplied.c',
  'draw/sw/blend/lv_draw_sw_blend_to_i1.c',
  'draw/sw/blend/lv_draw_sw_blend_to_l8.c',
  'draw/sw/blend/lv_draw_sw_blend_to_rgb565.c',
  'draw/sw/blend/lv_draw_sw_blend_to_rgb565_swapped.c',
  'draw/sw/blend/lv_draw_sw_blend_to_rgb888.c',
  'draw/sw/lv_draw_sw.c',
  'draw/sw/lv_draw_sw_arc.c',
  'draw/sw/lv_draw_sw_border.c',
  'draw/sw/lv_draw_sw_box_shadow.c',
  'draw/sw/lv_draw_sw_fill.c',
  'draw/sw/lv_draw_sw_grad.c',
  'draw/sw/lv_draw_sw_img.c',
  'draw/sw/lv_draw_sw_letter.c',
  'draw/sw/lv_draw_sw_line.c',
  'draw/sw/lv_draw_sw_mask.c',
  'draw/sw/lv_draw_sw_mask_rect.c',
  'draw/sw/lv_draw_sw_transform.c',
  'draw/sw/lv_draw_sw_triangle.c',
  'draw/sw/lv_draw_sw_utils.c',
  'draw/sw/lv_draw_sw_vector.c',
  'draw/vg_lite/lv_draw_buf_vg_lite.c',
  'draw/vg_lite/lv_draw_vg_lite.c',
  'draw/vg_lite/lv_draw_vg_lite_arc.c',
  'draw/vg_lite/lv_draw_vg_lite_border.c',
  'draw/vg_lite/lv_draw_vg_lite_box_shadow.c',
  'draw/vg_lite/lv_draw_vg_lite_fill.c',
  'draw/vg_lite/lv_draw_vg_lite_img.c',
  'draw/vg_lite/lv_draw_vg_lite_label.c',
  'draw/vg_lite/lv_draw_vg_lite_layer.c',
  'draw/vg_lite/lv_draw_vg_lite_line.c',
  'draw/vg_lite/lv_draw_vg_lite_mask_rect.c',
  'draw/vg_lite/lv_draw_vg_lite_triangle.c',
  'draw/vg_lite/lv_draw_vg_lite_vector.c',
  'draw/vg_lite/lv_vg_lite_decoder.c',
  'draw/vg_lite/lv_vg_lite_grad.c',
  'draw/vg_lite/lv_vg_lite_math.c',
  'draw/vg_lite/lv_vg_lite_path.c',
  'draw/vg_lite/lv_vg_lite_pending.c',
  'draw/vg_lite/lv_vg_lite_stroke.c',
  'draw/vg_lite/lv_vg_lite_utils.c',
  'drivers/display/drm/lv_linux_drm.c',
  'drivers/display/fb/lv_linux_fbdev.c',
  'drivers/display/ft81x/lv_ft81x.c',
  'drivers/display/ili9341/lv_ili9341.c',
  'drivers/display/lcd/lv_lcd_generic_mipi.c',
  'drivers/display/renesas_glcdc/lv_renesas_glcdc.c',
  'drivers/display/st7735/lv_st7735.c',
  'drivers/display/st7789/lv_st7789.c',
  'drivers/display/st7796/lv_st7796.c',
  'drivers/display/st_ltdc/lv_st_ltdc.c',
  'drivers/evdev/lv_evdev.c',
  'drivers/glfw/lv_glfw_window.c',
  'drivers/glfw/lv_opengles_debug.c',
  'drivers/glfw/lv_opengles_driver.c',
  'drivers/glfw/lv_opengles_texture.c',
  'drivers/libinput/lv_libinput.c',
  'drivers/libinput/lv_xkb.c',
  'drivers/nuttx/lv_nuttx_cache.c',
  'drivers/nuttx/lv_nuttx_entry.c',
  'drivers/nuttx/lv_nuttx_fbdev.c',
  'drivers/nuttx/lv_nuttx_image_cache.c',
  'drivers/nuttx/lv_nuttx_lcd.c',
  'drivers/nuttx/lv_nuttx_libuv.c',
  'drivers/nuttx/lv_nuttx_profiler.c',
  'drivers/nuttx/lv_nuttx_touchscreen.c',
  'drivers/qnx/lv_qnx.c',
  'drivers/sdl/lv_sdl_keyboard.c',
  'drivers/sdl/lv_sdl_mouse.c',
  'drivers/sdl/lv_sdl_mousewheel.c',
  'drivers/sdl/lv_sdl_window.c',
  'drivers/uefi/lv_uefi_context.c',
  'drivers/uefi/lv_uefi_display.c',
  'drivers/uefi/lv_uefi_indev_keyboard.c',
  'drivers/uefi/lv_uefi_indev_pointer.c',
  'drivers/uefi/lv_uefi_indev_touch.c',
  'drivers/uefi/lv_uefi_private.c',
  'drivers/wayland/lv_wayland.c',
  'drivers/wayland/lv_wayland_smm.c',
  'drivers/wayland/lv_wl_cache.c',
  'drivers/wayland/lv_wl_dmabuf.c',
  'drivers/wayland/lv_wl_keyboard.c',
  'drivers/wayland/lv_wl_pointer.c',
  'drivers/wayland/lv_wl_pointer_axis.c',
  'drivers/wayland/lv_wl_seat.c',
  'drivers/wayland/lv_wl_shell.c',
  'drivers/wayland/lv_wl_shm.c',
  'drivers/wayland/lv_wl_touch.c',
  'drivers/wayland/lv_wl_window.c',
  'drivers/wayland/lv_wl_window_decorations.c',
  'drivers/wayland/lv_wl_xdg_shell.c',
  'drivers/windows/lv_windows_context.c',
  'drivers/windows/lv_windows_display.c',
  'drivers/windows/lv_windows_input.c',
  'drivers/x11/lv_x11_display.c',
  'drivers/x11/lv_x11_input.c',
  'font/lv_binfont_loader.c',
  'font/lv_font.c',
  'font/lv_font_dejavu_16_persian_hebrew.c',
  'font/lv_font_fmt_txt.c',
  'font/lv_font_montserrat_10.c',
  'font/lv_font_montserrat_12.c',
  'font/lv_font_montserrat_14.c',
  'font/lv_font_montserrat_14_aligned.c',
  'font/lv_font_montserrat_16.c',
  'font/lv_font_montserrat_18.c',
  'font/lv_font_montserrat_20.c',
  'font/lv_font_montserrat_22.c',
  'font/lv_font_montserrat_24.c',
  'font/lv_font_montserrat_26.c',
  'font/lv_font_montserrat_28.c',
  'font/lv_font_montserrat_28_compressed.c',
  'font/lv_font_montserrat_30.c',
  'font/lv_font_montserrat_32.c',
  'font/lv_font_montserrat_34.c',
  'font/lv_font_montserrat_36.c',
  'font/lv_font_montserrat_38.c',
  'font/lv_font_montserrat_40.c',
  'font/lv_font_montserrat_42.c',
  'font/lv_font_montserrat_44.c',
  'font/lv_font_montserrat_46.c',
  'font/lv_font_montserrat_48.c',
  'font/lv_font_montserrat_8.c',
  'font/lv_font_simsun_14_cjk.c',
  'font/lv_font_simsun_16_cjk.c',
  'font/lv_font_source_han_sans_sc_14_cjk.c',
  'font/lv_font_source_han_sans_sc_16_cjk.c',
  'font/lv_font_unscii_16.c',
  'font/lv_font_unscii_8.c',
  'indev/lv_indev.c',
  'indev/lv_indev_gesture.c',
  'indev/lv_indev_scroll.c',
  'layouts/flex/lv_flex.c',
  'layouts/grid/lv_grid.c',
  'layouts/lv_layout.c',
  'libs/barcode/code128.c',
  'libs/barcode/lv_barcode.c',
  'libs/bin_decoder/lv_bin_decoder.c',
  'libs/bmp/lv_bmp.c',
  'libs/expat/xmlparse.c',
  'libs/expat/xmlrole.c',
  'libs/expat/xmltok.c',
  'libs/expat/xmltok_impl.c',
  'libs/expat/xmltok_ns.c',
  'libs/ffmpeg/lv_ffmpeg.c',
  'libs/freetype/lv_freetype.c',
  'libs/freetype/lv_freetype_glyph.c',
  'libs/freetype/lv_freetype_image.c',
  'libs/freetype/lv_freetype_outline.c',
  'libs/freetype/lv_ftsystem.c',
  'libs/fsdrv/lv_fs_cbfs.c',
  'libs/fsdrv/lv_fs_fatfs.c',
  'libs/fsdrv/lv_fs_littlefs.c',
  'libs/fsdrv/lv_fs_memfs.c',
  'libs/fsdrv/lv_fs_posix.c',
  'libs/fsdrv/lv_fs_stdio.c',
  'libs/fsdrv/lv_fs_uefi.c',
  'libs/fsdrv/lv_fs_win32.c',
  'libs/gif/gifdec.c',
  'libs/gif/lv_gif.c',
  'libs/libjpeg_turbo/lv_libjpeg_turbo.c',
  'libs/libpng/lv_libpng.c',
  'libs/lodepng/lodepng.c',
  'libs/lodepng/lv_lodepng.c',
  'libs/lz4/lz4.c',
  'libs/qrcode/lv_qrcode.c',
  'libs/qrcode/qrcodegen.c',
  'libs/rle/lv_rle.c',
  'libs/rlottie/lv_rlottie.c',
  'libs/svg/lv_svg.c',
  'libs/svg/lv_svg_decoder.c',
  'libs/svg/lv_svg_parser.c',
  'libs/svg/lv_svg_render.c',
  'libs/svg/lv_svg_token.c',
  'libs/tiny_ttf/lv_tiny_ttf.c',
  'libs/tjpgd/lv_tjpgd.c',
  'libs/tjpgd/tjpgd.c',
  'lv_init.c',
  'misc/cache/class/lv_cache_lru_ll.c',
  'misc/cache/class/lv_cache_lru_rb.c',
  'misc/cache/instance/lv_image_cache.c',
  'misc/cache/instance/lv_image_header_cache.c',
  'misc/cache/lv_cache.c',
  'misc/cache/lv_cache_entry.c',
  'misc/lv_anim.c',
  'misc/lv_anim_timeline.c',
  'misc/lv_area.c',
  'misc/lv_array.c',
  'misc/lv_async.c',
  'misc/lv_bidi.c',
  'misc/lv_circle_buf.c',
  'misc/lv_color.c',
  'misc/lv_color_op.c',
  'misc/lv_event.c',
  'misc/lv_fs.c',
  'misc/lv_grad.c',
  'misc/lv_iter.c',
  'misc/lv_ll.c',
  'misc/lv_log.c',
  'misc/lv_lru.c',
  'misc/lv_math.c',
  'misc/lv_matrix.c',
  'misc/lv_palette.c',
  'misc/lv_profiler_builtin.c',
  'misc/lv_rb.c',
  'misc/lv_style.c',
  'misc/lv_style_gen.c',
  'misc/lv_templ.c',
  'misc/lv_text.c',
  'misc/lv_text_ap.c',
  'misc/lv_timer.c',
  'misc/lv_tree.c',
  'misc/lv_utils.c',
  'osal/lv_cmsis_rtos2.c',
  'osal/lv_freertos.c',
  'osal/lv_linux.c',
  'osal/lv_mqx.c',
  'osal/lv_os.c',
  'osal/lv_os_none.c',
  'osal/lv_pthread.c',
  'osal/lv_rtthread.c',
  'osal/lv_sdl2.c',
  'osal/lv_windows.c',
  'others/file_explorer/lv_file_explorer.c',
  'others/font_manager/lv_font_manager.c',
  'others/font_manager/lv_font_manager_recycle.c',
  'others/fragment/lv_fragment.c',
  'others/fragment/lv_fragment_manager.c',
  'others/gridnav/lv_gridnav.c',
  'others/ime/lv_ime_pinyin.c',
  'others/imgfont/lv_imgfont.c',
  'others/monkey/lv_monkey.c',
  'others/observer/lv_observer.c',
  'others/snapshot/lv_snapshot.c',
  'others/sysmon/lv_sysmon.c',
  'others/test/lv_test_display.c',
  'others/test/lv_test_helpers.c',
  'others/test/lv_test_indev.c',
  'others/test/lv_test_indev_gesture.c',
  'others/test/lv_test_screenshot_compare.c',
  'others/vg_lite_tvg/vg_lite_matrix.c',
  'others/xml/lv_xml.c',
  'others/xml/lv_xml_base_types.c',
  'others/xml/lv_xml_component.c',
  'others/xml/lv_xml_parser.c',
  'others/xml/lv_xml_style.c',
  'others/xml/lv_xml_update.c',
  'others/xml/lv_xml_utils.c',
  'others/xml/lv_xml_widget.c',
  'others/xml/parsers/lv_xml_arc_parser.c',
  'others/xml/parsers/lv_xml_bar_parser.c',
  'others/xml/parsers/lv_xml_button_parser.c',
  'others/xml/parsers/lv_xml_buttonmatrix_parser.c',
  'others/xml/parsers/lv_xml_calendar_parser.c',
  'others/xml/parsers/lv_xml_canvas_parser.c',
  'others/xml/parsers/lv_xml_chart_parser.c',
  'others/xml/parsers/lv_xml_checkbox_parser.c',
  'others/xml/parsers/lv_xml_dropdown_parser.c',
  'others/xml/parsers/lv_xml_event_parser.c',
  'others/xml/parsers/lv_xml_image_parser.c',
  'others/xml/parsers/lv_xml_keyboard_parser.c',
  'others/xml/parsers/lv_xml_label_parser.c',
  'others/xml/parsers/lv_xml_obj_parser.c',
  'others/xml/parsers/lv_xml_roller_parser.c',
  'others/xml/parsers/lv_xml_scale_parser.c',
  'others/xml/parsers/lv_xml_slider_parser.c',
  'others/xml/parsers/lv_xml_spangroup_parser.c',
  'others/xml/parsers/lv_xml_table_parser.c',
  'others/xml/parsers/lv_xml_tabview_parser.c',
  'others/xml/parsers/lv_xml_textarea_parser.c',
  'stdlib/builtin/lv_mem_core_builtin.c',
  'stdlib/builtin/lv_sprintf_builtin.c',
  'stdlib/builtin/lv_string_builtin.c',
  'stdlib/builtin/lv_tlsf.c',
  'stdlib/clib/lv_mem_core_clib.c',
  'stdlib/clib/lv_sprintf_clib.c',
  'stdlib/clib/lv_string_clib.c',
  'stdlib/lv_mem.c',
  'stdlib/micropython/lv_mem_core_micropython.c',
  'stdlib/rtthread/lv_mem_core_rtthread.c',
  'stdlib/rtthread/lv_sprintf_rtthread.c',
  'stdlib/rtthread/lv_string_rtthread.c',
  'stdlib/uefi/lv_mem_core_uefi.c',
  'themes/default/lv_theme_default.c',
  'themes/lv_theme.c',
  'themes/mono/lv_theme_mono.c',
  'themes/simple/lv_theme_simple.c',
  'tick/lv_tick.c',
  'widgets/3dtexture/lv_3dtexture.c',
  'widgets/animimage/lv_animimage.c',
  'widgets/arc/lv_arc.c',
  'widgets/bar/lv_bar.c',
  'widgets/button/lv_button.c',
  'widgets/buttonmatrix/lv_buttonmatrix.c',
  'widgets/calendar/lv_calendar.c',
  'widgets/calendar/lv_calendar_chinese.c',
  'widgets/calendar/lv_calendar_header_arrow.c',
  'widgets/calendar/lv_calendar_header_dropdown.c',
  'widgets/canvas/lv_canvas.c',
  'widgets/chart/lv_chart.c',
  'widgets/checkbox/lv_checkbox.c',
  'widgets/dropdown/lv_dropdown.c',
  'widgets/image/lv_image.c',
  'widgets/imagebutton/lv_imagebutton.c',
  'widgets/keyboard/lv_keyboard.c',
  'widgets/label/lv_label.c',
  'widgets/led/lv_led.c',
  'widgets/line/lv_line.c',
  'widgets/list/lv_list.c',
  'widgets/lottie/lv_lottie.c',
  'widgets/menu/lv_menu.c',
  'widgets/msgbox/lv_msgbox.c',
  'widgets/objx_templ/lv_objx_templ.c',
  'widgets/property/lv_animimage_properties.c',
  'widgets/property/lv_dropdown_properties.c',
  'widgets/property/lv_image_properties.c',
  'widgets/property/lv_keyboard_properties.c',
  'widgets/property/lv_label_properties.c',
  'widgets/property/lv_obj_properties.c',
  'widgets/property/lv_roller_properties.c',
  'widgets/property/lv_slider_properties.c',
  'widgets/property/lv_style_properties.c',
  'widgets/property/lv_textarea_properties.c',
  'widgets/roller/lv_roller.c',
  'widgets/scale/lv_scale.c',
  'widgets/slider/lv_slider.c',
  'widgets/span/lv_span.c',
  'widgets/spinbox/lv_spinbox.c',
  'widgets/spinner/lv_spinner.c',
  'widgets/switch/lv_switch.c',
  'widgets/table/lv_table.c',
  'widgets/tabview/lv_tabview.c',
  'widgets/textarea/lv_textarea.c',
  'widgets/tileview/lv_tileview.c',
  'widgets/win/lv_win.c',
]

lvgl = library(
  'lvgl',
  c_args: cfg,
  link_with: lvgl_links,
  sources: lvgl_src,
)

lvgl_dep = declare_dependency(
  compile_args: cfg,
  include_directories: include_directories('.'),
  link_with: lvgl,
)
